package zut.service.impl;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import zut.dao.LessonDao;
import zut.model.Lesson;
import zut.service.LessonService;

import java.util.List;

@Service
public class LessonServiceImpl implements LessonService{
@Autowired
LessonDao lessonDao;


    public void add(String name, String password) {
        lessonDao.add(name,password);
    }


    public void delete(String name) {
        lessonDao.delete(name);
    }


    public List<Lesson> selecAll() {
        List<Lesson> lessons=lessonDao.selecAll();
        return lessons;
    }


    public Lesson selectByName(String name, String password) {
            Lesson lesson=lessonDao.selectByName(name,password);
            if(lesson!=null){
              lessonDao.selecAll();
            }
                return null;
    }


    public void update(Lesson lesson) {
            lessonDao.update(lesson);
    }
}
